package com.wtpaint.zeuslib;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.wtpaint.lib.bus.ZBus;
import com.wtpaint.lib.bus.annotation.ZSubscribe;
import com.wtpaint.zeuslib.db.DbActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.id_db_btn).setOnClickListener(this);
        ZBus.getDefault().register(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.id_db_btn:

//                ZeusSkinManager.getInstance().loadSkin("/storage/emulated/0/skinutils-debug.skin");
//                gotoNext(DbActivity.class);
                ZBus.getDefault().post("Test", "传递消息");
                break;
        }
    }

    private void gotoNext(Class clz) {
        Intent intent = new Intent(this, clz);
        startActivity(intent);
    }

    @ZSubscribe({"Test"})
    public void getMyMessage(String msg) {
        Log.i("TAG", "xx" + msg);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ZBus.getDefault().unregister(this);
    }
}
